home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / graphics / blobs.rea < prev    next >
Text File  |  1996-11-16  |  3KB  |  152 lines

  1. :
  2. #!/bin/bash
  3. #
  4. # briefme - top package agent. Copyright (c) 1993 (Gil Nardo)
  5. #    see files in NOTICE for legalease
  6.  
  7. _briefme()
  8. {
  9. #
  10. # README starts here
  11. #
  12.  
  13. more <<-TOHERE
  14.  
  15.     This is a port of 'blobs' originally written by Russell Wallace
  16.     and ported to Linux by Gil Nardo (gil@netcom.com).
  17.  
  18.     The idea is simple: microbes (or blobs) fly around on the screen
  19.     and zap each other. You can control the pseudo-random violence
  20.     via command line parameters.
  21.     
  22.     This README file doubles as both a README and as a Bash executable
  23.     package agent -- a program that helps navigate, explain, and
  24.     maintain parts of a software package. { Package Agent (tm) :-) }
  25.  
  26.     For those who do not have the command shell 'Bash', or have
  27.     trouble using this script, or wish to go straight to using
  28.     the package, here are the manual directions to follow to get
  29.     you going, ASAP.
  30.  
  31.     1) execute make
  32.     2) run blobs with parameters 15 10 20 50 1
  33.     3) for help just run blobs without any parameters
  34.  
  35.  
  36.     The files located at this level are
  37.  
  38.     README*        readable bash executable package agent
  39.     blobs.c        blobs source
  40.     msleep.c    source for micro second sleeps
  41.     makefile    create blobs program
  42.     NOTICE        damn legalease
  43.     COPYING        more damn legalease
  44.  
  45. TOHERE
  46.  
  47. #
  48. # README ends here
  49. #
  50.  
  51. }
  52.  
  53.  
  54.  
  55.  
  56. # Prompt for yes or no answer - returns non-zero for no
  57. _getyn()
  58. {
  59.         while   echo -n "$* (y/n) ">&2
  60.         do      read yn rest
  61.                 case $yn in
  62.                 [yY])   return 0                      ;;
  63.                 [nN])   return 1                      ;;
  64.                 *)      echo "Please answer y or n" >&2 ;;
  65.                 esac
  66.         done
  67. }
  68.  
  69. # look for an archive sitting with the README file
  70. _check_archive()
  71. {
  72.     local ARCNAME
  73.     local ARCPLACE
  74.  
  75.     ARCNAME=$1
  76.  
  77.     if [ ! -f $ARCNAME ]
  78.     then return
  79.     fi
  80.  
  81.     echo Archive file ${ARCNAME} is available
  82.  
  83.     case $ARCNAME in
  84.  
  85.         *.taz)
  86.             if (_getyn "Extract files from gzipped tar?")
  87.             then
  88.                 tar -zxvf $ARCNAME
  89.             fi
  90.             ;;
  91.  
  92.         *.tgz | *.tpz)
  93.             if (_getyn "Reverse gzip then extract from tar?")
  94.             then
  95.                 gunzip < $ARCNAME | tar -xvf -
  96.             fi
  97.             ;;
  98.  
  99.         *.tar)
  100.             if (_getyn "Extract files from tar?")
  101.             then
  102.                 tar xvf $ARCNAME
  103.             fi
  104.             ;;
  105.  
  106.         *)
  107.             echo Dont know how to handle archive file $ARCNAME
  108.             return
  109.             ;;
  110.     esac
  111.  
  112.     ARCPLACE=archive
  113.  
  114.     if (_getyn "Move $ARCNAME to directory $ARCPLACE?")
  115.     then
  116.         if [ ! -d  $ARCPLACE ]
  117.         then
  118.             mkdir $ARCPLACE
  119.         fi
  120.         if [ ! -d $ARCPLACE ]
  121.         then
  122.             echo Could not create $ARCPLACE directory
  123.             return
  124.         fi
  125.         mv $ARCNAME $ARCPLACE
  126.     fi
  127.  
  128. }
  129.  
  130. #
  131. # main()
  132. #
  133.     QUICKLY=$1
  134.  
  135.     _briefme
  136.  
  137.     if [ -z "$BASH_VERSION" ]
  138.     then
  139.         echo "I want to be bash'd!"
  140.         _getyn "Continue running in this shell anyway?" || exit
  141.     fi
  142.  
  143.     _check_archive `echo *.tgz`
  144.  
  145.     if [ ! -z "$QUICKLY" ]
  146.     then exit
  147.     fi
  148.  
  149.     _getyn "make the executables?" && make
  150.  
  151.     _getyn "clean up objects?" && make clean
  152.